package de.unihannover.hci.portraitquiz.helper;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;

public class ShapeObstacle {
	
	public enum DIFFICULTY {
		NONE, EASY, MIDDLE, HARD, 
	}
	
	private static List<Drawable> obstacles;
	
	private static Context mContext;
	private static boolean initialized = false;
	
	/** singleton */
	private static ShapeObstacle instance;
	
	@Deprecated
	private ShapeObstacle(Context c){
		this.mContext = c;
		obstacles = new ArrayList<Drawable>();
		fillObstacles();
	}
	
	private static void fillObstacles() {
		Drawable stroke = null;
		try {
			stroke = Drawable.createFromStream(
					mContext.getAssets().open("obstacles/easy.png"), null);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		obstacles.add(stroke);
		
		
		Drawable stroke2 = null;
		try {
			stroke2 = Drawable.createFromStream(
					mContext.getAssets().open("obstacles/middle.png"), null);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		obstacles.add(stroke2);
		
		
	}

	@Deprecated
	public static ShapeObstacle getInstance(Context c){
		if(instance == null){
			instance = new ShapeObstacle(c);
		}
		return instance;
	}
	
	public static void initialize(Context context){
		mContext = context;
		obstacles = new ArrayList<Drawable>();
		fillObstacles();
		initialized = true;
	}
	
	public static boolean isInitialized(){
		return initialized;
	}
	
	public static Drawable getObstacle(int i){
		return obstacles.get(i);
	}

	public static int size() {
		return obstacles.size();
	}
	

}
